#pragma once

#include "Common.cpp"

#include<memory>
class ThreadCache
{
public:
    void* Allocate(size_t size);//申请内存对象
    void Deallocate(void* ptr, size_t size);//释放内存对象
    void* FetchFromCentralCache(size_t index,size_t size);//从CentralCache中获取内存对象
    void ListTooLong(FreeList& list,size_t size);//回收内存对象到CentralCache中
private:
    FreeList _freeLists[NFREELISTS];//哈希桶
};

static thread_local ThreadCache* pTLSThreadCache = nullptr;//线程局部变量，每个线程一个ThreadCache